package com.lsa.helpers.tree;

import java.util.ArrayList;
import java.util.List;

public class TreeNode<T> implements ITreeNode<T>
{
    private T data;
    private List<ITreeNode<T>> children = new ArrayList<ITreeNode<T>>();
    
    public TreeNode(T data)
    {
        this.data = data;
    }

    @Override
    public T getData()
    {
        return data;
    }
    
    @Override
    public void setData(T data)
    {
        this.data = data;
    }

    @Override
    public List<ITreeNode<T>> getChildren()
    {
        return children;
    }

    public void addChild(ITreeNode<T> child)
    {
        children.add(child);
    }

    @Override
    public String toString()
    {
        return "TreeNode [data=" + data + "]";
    }
}
